﻿using System.Collections.Generic;
using DictationTool.Common;

namespace TextCompare
{
    class CompareStringControl : ICompareControl
    {
        public double CorrectPercent { get; set; }

        public IEnumerable<MatchPoint> GenerateComparedText(string source, string target)
        {
            return Compare(source, target);
        }

        private IEnumerable<MatchPoint> Compare(string sourceText, string targetText)
        {
            TextMatch match = new TextMatch(TextMatcher(sourceText, targetText));
            var points = match.Match();
            CorrectPercent = match.CorrectPercent;

            return points;
        }

        public ITextMatcher TextMatcher(string sourceText, string targetText)
        {
            return new StringTextMatcher(sourceText, targetText);
        }
    }
}
